import QtQuick
import QtQuick3D

import Utils as Utils
import "../Room"

//房间生成控制器
Node{
    id:root
    property int seed:1000

    property vector3d extend:Qt.vector3d(3,1,3)//房间的规模数量

    property vector3d roomExtend:Qt.vector3d(16,6,16)//单个房间的规模

    property vector3d roomMargin:roomExtend.plus(Qt.vector3d(2,2,2))

    Utils.RoomStructEngine{
        id:roomEngine
        seed:root.seed
        extend:root.extend
    }



    Component.onCompleted: {
        roomEngine.generate()
    }

    NormalBuilder{

    }



    Repeater3D{

        model:roomEngine.rooms

        delegate:CaveRoom{
            id:room

            property Utils.Room roomData :modelData
            roomType:roomData.type
            seed:{
                let ret = root.seed
                ret += roomData.position.y * root.extend.x * root.extend.z
                ret += roomData.position.z * root.extend.x
                ret += roomData.position.x

                return ret
            }

            position:roomData.position.times(roomMargin).times(100)
        }
    }



}
